package com.elysia.adminservice.controller;

import com.elysia.adminservice.domain.dto.PasswordDTO;
import com.elysia.adminservice.result.Result;
import com.elysia.adminservice.service.impl.IUserServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/password")
@RequiredArgsConstructor
@Slf4j
public class PasswordController {
    private final IUserServiceImpl userService;
    @PatchMapping
    public Result<Object> reset(@RequestBody PasswordDTO passwordDTO, @RequestHeader("X-seacross-id") Long userId) {
        log.info("id: {},重置密码请求: {}", userId , passwordDTO);
        userService.reset(userId, passwordDTO.getNewPassword());
        return Result.success();
    }
}
